﻿using ConsoleApp1.utils;
using WinFormsApp1.bo;
using WinFormsApp1.outputBo;
using WinFormsApp1.utils;

namespace WinFormsApp1;

/**
 * 项目执行方法
 */
public class DoWork
{
    public static void start()
    {

        // 读取并解析输入Excel文件
        List<TPSTR04> inputList1 = new List<TPSTR04>();
        List<TPMOUTR02> inputList2 = new List<TPMOUTR02>();
        List<TMMTR00> inputList3 = new List<TMMTR00>();
        ExcelProcess.readInputExcel1(ref inputList1, ref inputList2, ref inputList3);

        List<ActualCutResult> inputList4 = new List<ActualCutResult>();
        ExcelProcess.readInputExcel2(ref inputList4);

        // 计算获得输出对象
        List<RateOfRecord> rateOfRecordList = new List<RateOfRecord>();
        List<RateOfPlan> rateOfPlanList = new List<RateOfPlan>();
        List<RateOfAll> rateOfAllList = new List<RateOfAll>();
        CalculateActualRate calculateActualRate = new CalculateActualRate();
        calculateActualRate.calculateActualRate(inputList1, inputList2, inputList3, inputList4, ref rateOfRecordList,
            ref rateOfPlanList, ref rateOfAllList);
    
        // 输出对象写入Excel文件中
        ExcelProcess.writeOutputToExcel(rateOfRecordList, rateOfPlanList, rateOfAllList);
        LogUtil.addLog("计算结果生成完毕");

    }
}